package cn.mystylefree.proxydemo.dynamicproxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @program my-project-model
 * @description:
 * @author: lee
 * @create: 2022/07/14 20:12
 */
public class DynamicProxyHandler<T> implements InvocationHandler {
    private T target;

    public DynamicProxyHandler(T target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("我是动态代理类，增强了被代理的方法，输出前");
        Object invoke = method.invoke(target, args);
        System.out.println("我是动态代理类，增强了被代理的方法，输出后");
        return null;
    }
}
